var t = require;
var e = module;
var o = exports;
var n =
        (this && this.__extends) ||
        (function () {
            var t = function (e, o) {
                return (t =
                    Object.setPrototypeOf ||
                    ({__proto__: []} instanceof Array &&
                        function (t, e) {
                            t.__proto__ = e;
                        }) ||
                    function (t, e) {
                        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                    })(e, o);
            };
            return function (e, o) {
                function n() {
                    this.constructor = e;
                }
                t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
            };
        })(),
    r =
        (this && this.__decorate) ||
        function (t, e, o, n) {
            var r,
                a = arguments.length,
                i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
            return a > 3 && i && Object.defineProperty(e, o, i), i;
        };
Object.defineProperty(o, "__esModule", {value: !0}), (o.FriendHelp = void 0);
var a = t("Platforms"),
    i = t("Sounds"),
    s = t("FriendItem"),
    c = t("Const"),
    l = t("Popup"),
    u = t("OpenDataContexts"),
    p = t("BootConst"),
    f = t("ConfS"),
    d = cc._decorator,
    h = d.ccclass,
    y =
        (d.property,
        (function (t) {
            function e() {
                return (null !== t && t.apply(this, arguments)) || this;
            }
            return (
                n(e, t),
                (e.prototype.init = function () {
                    var t = this;
                    if (a.default.platformCtrl.显示好友助力) {
                        var e,
                            o = this.node.getChildByName("container");
                        (this._items = o.getChildByName("scrollView").getChildByName("view").getChildByName("items")),
                            (this.yaoqing = o.getChildByName("yaoqingContainer").getChildByName("yaoqing")),
                            this.yaoqing.on(cc.Node.EventType.TOUCH_END, function () {
                                i.Sounds.playFX("点击"), a.default.platformCtrl.share(p.dd.friendHelp, null);
                            }),
                            (this.close = o.getChildByName("close")),
                            this.close.on(cc.Node.EventType.TOUCH_END, function () {
                                i.Sounds.playFX("点击"), t.hide();
                            }),
                            c.default.wid0 > c.default.hei0
                                ? (e = 2)
                                : ((o.width = 640),
                                  (o.height = c.default.shei - 200),
                                  (o.y = -c.default.shei / 2 + 150),
                                  (e = 1));
                        var n = c.default.wid0 > c.default.hei0 ? 958 : 478;
                        (this.odc = u.default.get(n, 100)),
                            this.odc
                                ? (this.addItems(100, e, Math.round(this.odc.height / 100)),
                                  this._items.addChild(this.odc))
                                : this.addItems(100, e, 20 / e);
                    }
                }),
                (e.prototype.addItems = function (t, e, o) {
                    for (var n = -1, r = 0; r < o; r++)
                        for (var i = 0; i < e; i++) {
                            n++;
                            var c = a.default.prefabs.instantiate("FriendItem").getComponent(s.FriendItem);
                            this._items.addChild(c.node), (c.node.x = 480 * i), (c.node.y = -t * r), c.init(n);
                        }
                    this._items.height = t * o;
                }),
                (e.prototype.refresh = function () {
                    u.default.refresh(this.odc);
                }),
                (e.prototype.show = function () {
                    t.prototype.show.call(this),
                        this.odc &&
                            (u.default.firstSaveUserCloudStorage(),
                            u.default.draw(this.odc, {
                                op: "drawPotentialFriends",
                                w: c.default.wid0 > c.default.hei0 ? 2 : 1,
                                cap: this.odc.cap,
                                gap: this.odc.gap,
                                赠送钻石: f.DatasManager.每邀请一位好友送出奖励数,
                                奖励钻石: f.DatasManager.每成功邀请一位好友获得奖励数
                            })),
                        a.default.delays.delay({
                            time: 0.3,
                            action: function () {
                                a.default.platformCtrl.toast(
                                    "好友得到" +
                                        f.DatasManager.好友助力奖励货币名称 +
                                        "，\n你也得到" +
                                        f.DatasManager.好友助力奖励货币名称 +
                                        "！"
                                );
                            }
                        });
                }),
                (e.prototype.showComplete = function () {
                    t.prototype.showComplete.call(this);
                }),
                (e.prototype.hide = function () {
                    t.prototype.hide.call(this);
                }),
                (e.prototype.hideComplete = function () {
                    if ((t.prototype.hideComplete.call(this), this.onHide)) {
                        var e = this.onHide;
                        (this.onHide = null), e();
                    }
                    u.default.getFriendCloudStorage();
                }),
                (e = r([h], e))
            );
        })(l.Popup));
o.FriendHelp = y;
